{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 《Python数据分析基础》DaPy\n",
    "### 【第7章 数据的模型分析】数据与练习7 \n",
    "#### **（请在#下面问题的空白处写出代码并输出结果）**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "7.1 今测得汽车的行驶速度speed和刹车距离dist数据如下。\n",
    "\n",
    "    speed: 4,4,7,7,8,9\n",
    "    dist: 2,10,4,22,16,10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（1）做speed与dist的散点图，并以此判断speed与dist之间是否大致呈线性关系。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（2）计算speed与dist的相关系数并做假设检验。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（3）做speed对dist的OLS回归，并给出常用统计量。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（4）预测当speed=30时，dist等于多少。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "7.2 由专业知识可知，合金的强度 y（107Pa）与合金中碳的含量x（%）有关。为了生产出强度满足顾客需要的合金，在冶炼时应该如何控制碳的含量？\n",
    "    如果在冶炼过程中通过化验得知了碳的含量，能否预测这炉合金的强度？\n",
    "    \n",
    "    x：0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.20, 0.21, 0.23\n",
    "    y：42, 43.5, 45, 45.5, 45, 47.5, 49, 53, 50, 55, 55, 60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（1）做x与y的散点图，并以此判断x与y之间是否大致呈线性关系。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（2）计算x与y的相关系数并做假设检验。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（3）做y对x的最小二乘回归，并给出常用统计量。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#（4）估计当x=0.22时，y等于多少? 预测当x=0.25时，y等于多少?\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
